import { RouteRecordRaw } from 'vue-router';

const buildMainRouter = (route: RouteRecordRaw) => {
  return {
    path: '/',
    component: () => import('layouts/MainLayout.vue'),
    children: [route],
  };
};

const routes: RouteRecordRaw[] = [
  // buildMainRouter({ path: '', component: () => import('pages/IndexPage.vue') }), // 首页
  buildMainRouter({ path: '', component: () => import('pages/approve/ApprovePage.vue') }), // 授权页面
  buildMainRouter({ path: 'protocol', component: () => import('pages/protocol/Protocol.vue') }), // 协议授权页面
  buildMainRouter({ path: 'down', component: () => import('pages/down/DownPage.vue') }), // 下载页
  buildMainRouter({ path: 'prodList', component: () => import('pages/prodList/ProdListPage.vue') }), // 产品列表页
  buildMainRouter({ path: 'feedback', component: () => import('pages/feedback/FeedBack.vue') },), // 反馈投诉页
  buildMainRouter({ path: 'evaluate', component: () => import('pages/evaluate/EvaluatePage.vue') }), // 结果页
  buildMainRouter({ path: 'evaluateAuth', component: () => import('pages/evaluate/AuthEvaluatePage.vue') }), // 仅实名结果页
  buildMainRouter({ path: 'infoInput', component: () => import('pages/infoInput/InfoInput.vue') }), // 资质信息填写页
  buildMainRouter({ path: 'mechanism', component: () => import('pages/mechanism/MechanismPage.vue') }), // 机构列表授权页
  buildMainRouter({ path: 'realNameAuth', component: () => import('pages/realNameAuth/RealNameAuth.vue') }), // 实名页
  buildMainRouter({ path: 'waitPage', component: () => import('pages/waitPage/WaitPage.vue') }), // 等待页
  buildMainRouter({ path: 'webview', component: () => import('pages/webview/WebView.vue') }), // webview iframe 页面

  // Always leave this as last one,
  // but you can also remove it
  {
    path: '/:catchAll(.*)*',
    component: () => import('pages/ErrorNotFound.vue'),
  },
];

export default routes;
